package com.arpa.wms.service;

import com.arpa.core.web.Result;
import com.arpa.wms.domain.dto.ReceiveItemDTO;
import com.arpa.wms.domain.entity.ReceiveItem;
import com.arpa.wms.domain.vo.ReceiveItemVO;
import com.arpa.wms.domain.vo.ReceiveItemWithRegisterVO;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 * <p>
 * 收货明细 服务类
 * </p>
 *
 * @author LEO
 * @since 2020-08-04
 */
public interface IReceiveItemService extends IService<ReceiveItem> {

    /**
     * 保存
     * @param entity
     * @return
     */
    @Override
    boolean save(ReceiveItem entity);

    /**
     * 根据code更新实体
     * @param entity
     * @return
     */
    int updateByCode(ReceiveItem entity);

    /**
     * 查询列表
     * @param receiveItemDTO
     * @return
     */
    List<ReceiveItemVO> queryList(ReceiveItemDTO receiveItemDTO);

     /**
      *  @author: Allen chen
      *  @Date: 2020/10/8 15:17
      *  @Description: 根据商品code查询明细列表
      */
    List<ReceiveItemVO> getReceiveItemByGoods(List<String> list);

    /**
     * 查询合计,包含总数
     * @param receiveItemDTO
     * @return
     */
    ReceiveItemVO queryListSum(ReceiveItemDTO receiveItemDTO);


    /**
     * 获取详情
     * @param code code
     * @return
     */
    ReceiveItemVO getOneByCode(String code);

    /**
     * 关联主表查询收货单信息
     * @param receiveItemDTO
     * @return
     */
    List<ReceiveItemVO> queryWithReceiveList(ReceiveItemDTO receiveItemDTO);

    List<ReceiveItem> queryAllListByReceiveCode(String receiveCode,String groupCode);

    List<ReceiveItemWithRegisterVO> queryItemWithRegisterList(ReceiveItemDTO receiveItemDTO);

    List<ReceiveItemWithRegisterVO> queryItemWithRegisterListByPaging(ReceiveItemDTO receiveItemDTO);

    /**
     * 查询退货单明细
     * @param receiveItemDTO
     * @return
     */
    List<ReceiveItemVO> queryReturnList(ReceiveItemDTO receiveItemDTO);

    Result register(ReceiveItemDTO receiveItemDTO);

    /**
     * 获取收货单可退明细
     * @author xuyang
     * @date 2020/12/15 18:37
     * @param receiveCode:
     * @return
     **/
    List<ReceiveItemVO> findReceiveRefundItems(String receiveCode);

    /**
     * 统计收货确认单上架数量，更新指定收货明细单的上架数量
     * @param receiveItemCode
     */
    void refreshPutawayQuantity(String receiveItemCode);

    /**
     * 统计收货确认单上架数量，更新指定收货明细单的上架和入库数量
     * @param receiveItemCode
     */
    void refreshPutawayAndInboundQuantity(String receiveItemCode);

    /**
     * 查询明细、收货登记信息， 带分页逻辑
     * @param receiveItemDTO
     * @return
     */
    List<ReceiveItemWithRegisterVO> queryItemWithRegisterListWithPage(ReceiveItemDTO receiveItemDTO);

    /**
     * 更新收货明细里的商品保质期
     * @param code
     * @param goodsCode
     * @return
     */
    boolean updateExpirationQuantity(String code, String goodsCode);
}
